#include <pthread.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>

#define PTHREAD_NUM 2

void *thrfunc1(void *arg)
{
    static int count = 1;
    pthread_exit((void *)(&count));
}

void *thrfunc2(void *arg)
{
    static int count = 2;
    return (void *)(&count);
}

int main()
{
    pthread_t pid[PTHREAD_NUM];
    int retPid;
    int *pRet1;
    int *pRet2;
    retPid = pthread_create(&pid[0], NULL, thrfunc1, NULL);
    retPid = pthread_create(&pid[1], NULL, thrfunc2, NULL);
    pthread_join(pid[0], (void **)&pRet1);
    printf("get thread0 exitcode:%d\n", *pRet1);
    pthread_join(pid[1], (void **)&pRet2);
    printf("get thread1 exitcode:%d\n", *pRet2);
    return 0;
}